package cn.antho.superhelp.fallback;

import cn.antho.superhelp.exception.GlobalExceptionCodeEnum;
import cn.antho.superhelp.feign.StaffService;
import cn.antho.superhelp.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class StaffServiceFallbackFactory implements FallbackFactory<StaffService> {

    @Override
    public StaffService create(Throwable throwable) {
        return new StaffService() {

            @Override
            public JsonResult selectOne(Long id) {
                return JsonResult.error(GlobalExceptionCodeEnum.ERROR);
            }
        };
    }
}
